<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
    <head>
        <title></title>
        <meta charset="utf-8">
        <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
        <link rel="stylesheet" href="css/ui-base.css">
        <link rel="stylesheet" href="css/ui-box.css">
        <link rel="stylesheet" href="css/project/style.css">
        <link rel="stylesheet" href="css/zv_common.css">
        <script src="js/zy_control.js">
        </script>
        <script src="js/zy_click.js">
        </script>
        <script src="js/zy_json.js">
        </script>
        <script src="js/main.js">
        </script>
        <script src="js/init.js">
        </script>
        <script src="js/JsonSQL/jsonsql-0.1.js">
        </script>
		<script src="js/talkingdata.js"></script>
        <style>
            #taskList {
                width: 100%;
                background: #fff;
                overflow-x: hidden;
				text-align:center; margin:0 auto
            }
            .listicon{ padding:1px; width:98%; margin:0 auto; text-align:center;}
            .icon {
                width:20%;
                padding: 0em;
                float: left;
                text-align: center;
                font-size: 0.8em;
				background:url(images/ededed.png) right bottom repeat-y;
				border-bottom:solid #ededed 1px;
            }
            
            .icon img {
                width: 70%;
                padding: 1em 0.5em 0.5em 0.5em
            }
            
            .txt {
                margin-bottom: 0.8em; overflow:hidden; white-space:nowrap;/*text-overflow:ellipsis;*/
            }
            
         
            .right {
                float: right;
                right: -1px
            }
            
            .selected {
            	background:#ededed;
                background: url(images/selected.png) no-repeat top right #f8ffc9;
				
                background-size: 1.5em;
                z-index: 999999;
				height:100%; padding-right:1px;padding-bottom:1px; ma
            }
        </style>
    </head>
    <body class="um-vp c-wh" style="overflow-x:hidden;  background:#ffffff">
        <div id="taskList">
        </div>
    </body>
    <script>
        zy_init();
        /**
         * 判断是否包含样式
         * @param {Object} obj
         * @param {Object} cls
         */
        function hasClass(obj, cls){
            return obj.className.match(new RegExp('(\\s|^)' + cls + '(\\s|$)'));
        }
        
        function checkTaks(id){
            var zv_LocalTask = localStorage.getItem("zv_LocalTask");
            if (zv_LocalTask == null || zv_LocalTask == undefined || zv_LocalTask == "") {
                zv_LocalTask = ",";
            }
            var obj = document.getElementById("taks_" + id);
            var cls = "selected";
            if (!this.hasClass(obj, cls)) {
                //添加节点
                zv_LocalTask += id + ",";
                obj.className += " " + cls;
            }
            else {
                //移除节点
                zv_LocalTask = zv_LocalTask.replace("," + id + ",", ",");
                var reg = new RegExp('(\\s|^)' + cls + '(\\s|$)');
                obj.className = obj.className.replace(reg, ' ');
				
            }
			//obj.style.display="none";
            zv_LocalTask = zv_LocalTask.replace(",,", ",");
            localStorage.setItem("zv_LocalTask", zv_LocalTask);
        }
        
        window.uexOnload = function(type){
     	   IC.talkingDataCount("智能监控","0019");
            //var Site = "PVG";//取上一个界面选择的站点
            Loading(0);
            getIconList();
        }
		function getIconList()
		{
			$.getJSON("data/Category.json", function(json){
             
				var res = jsonsql.query("select * from json.data.items where (PID=='145') order by OrderBy asc", json);
                var str = "";
                var zv_LocalTask = localStorage.getItem("zv_LocalTask");
                if (zv_LocalTask == null || zv_LocalTask == undefined || zv_LocalTask == "") {
                    zv_LocalTask = "";
                }
				
                for (var i = 0; i < res.length; i++) {

                    var isSelected = "";
                    if (zv_LocalTask.indexOf(","+res[i].ID+",") >=0) {
                        isSelected = "selected";
                    }
                    str += '<div class="icon"><div class="listicon '+isSelected+'"  id="taks_' + res[i].ID + '" onclick="checkTaks(' + res[i].ID + ')">';
                    str += '<div><img src="taskImg/' + res[i].Icon + '"></div>';
                    str += '<div class="txt">' + res[i].Name + '</div>';
                    str += '</div></div>';
                }
				//alert(str);
                $$("taskList").innerHTML = str;
                Loading(-1);
            });
		}
    </script>
</html>
